In a , you can apply sorting on a data region, grouped data or fixed page.
Use the following steps to determine how to sort your data. These steps assume that you have already added a Page Report (xml-based) template to your project and connected it to a data source. See Adding an ActiveReport to a Project, Connect to a Data Source and Add a Dataset for more information.
Sorting in a Data Region
You can set the sorting expression on the Sorting page of a data region dialog.
- Right-click the data region and select Properties to open the Properties window. Select the Property dialog link under properties where the commands are displayed to open the data region dialog. See Properties Window for more information.
- In the dialog that appears, go to the Sorting page and click the Add(+) icon to add an empty expression to the sorting list below.
- In the Expression field, enter the expression directly or use <Expression...> from the dropdown to open the Expression Editor and select the field on which you want to sort your data.
- Under Direction, select Ascending or Descending to set the order in which to sort your data.
- Click OK to close the dialog.
- From the Report Explorer, drag and drop the field on which the sorting expression is set and go to the to view the result.
The following image shows the result after setting sorting in a Table data region on the Title field in Ascending order:
Sorting on Grouped Data
You can sort the order of groups through the Sorting tab of the Groups page or the Detail Grouping page of the List data region. The following steps assume that you have already grouped data in the data region. See Grouping in a Data Region for further information on grouping.
|
Note: In a Chart data region dialog, the Sorting tab is available on the Category Groups and Series Groups pages. |
- On the Groups or the Detail Grouping page of the data region dialog, select the Sorting tab.
- In the Sorting tab, click the Add(+) icon to add an empty expression to the sorting list.
- In the Expression field, enter the expression directly or use <Expression...> from the dropdown to open the Expression Editor and select the field on which you want to sort your data. The expression set here should be the same as the grouping expression.
- Under Direction, select Ascending or Descending to set the order in which to sort your data.
- Click OK to close the dialog.
- From the Report Explorer, drag and drop the field on which sorting is set and go to the to view the result.
The following image shows the result on a Table data region where grouping and sorting is set on the StorePrice field in Descending order:
Sorting on a Fixed Page
In a fixed page layout (), if the fixed page is grouped on a dynamic value, you can sort the order of the groups through the Sorting page of the . Follow the steps below to learn setting up sorting on a Fixed Page:
- Right-click the gray area of the report and select Fixed Layout Settings to open the FixedPage dialog.
OR
Right click the report page and select Properties to open the Properties window. Select the Property dialog link under properties where the commands are displayed to open the FixedPage dialog. See Properties Window for more information on commands.
- In the FixedPage dialog that appears, go to the Grouping page and in the Expression field, enter the expression directly or use <Expression...> from the dropdown to open the Expression Editor and select the field on which you want to group your data.
- In the FixedPage dialog, now go to the Sorting page and click the Add(+) icon to add an empty expression to the sorting list below and in the Expression field enter the same expression you used for grouping the data.
- Under Direction, select Ascending or Descending to set the order in which to sort your data.
- Click OK to close and apply the settings.
- From the Report Explorer, drag and drop the field on which sorting is set and go to the to view the result.
|
Note: The difference in setting sorting on a Fixed Page is that it affects every data region placed on the report layout, whereas sorting on a data region is limited to the data region only. |
The following images shows the result when sorting is set on a fixed page on the StorePrice field in descending order:
See Also